#include "Nod.h"
#include "Nod.h"
#include <iostream>
#include <string>
#include <fstream>
#include <vector>



int main()
{
	std::vector<Nod* const> Nods;
	std::string filename;
	std::ifstream File;
	int NodNr;
	Nod StartNod(0), EndNod(0);

	std::cout<<"wpisz nazwe pliku: ";
	std::cin>>filename;
	File.open(filename.c_str());
	if (!File.good())
	{
			std::cout<<"nie udalo otworzyc sie" + filename;
	}
	
	File>>NodNr;

	for(int i=0; i<NodNr; i++)
	{
		int currentLenght; 
		File>>currentLenght;
		Nods.push_back(new Nod(currentLenght));
	}



	for (int i=0; i<NodNr; i++)
	{
		for (int j=0; j<NodNr; j++)
		{
			bool connection;
			File>>connection;
			if (connection)
			{
				Nods.at(i)->addChild(Nods.at(j));
				Nods.at(j)->addParent(Nods.at(i));
			}
		}
	}

	for (int i = 0; i< NodNr; i++) 
	{
		std::cout<<"wezel "<< i<< std::endl;
		Nods.at(i)->showFamily();
	}




	system("PAUSE");
}